package com.datoucai.rpc;

import com.datoucai.common.api.UserFeignService;
import com.datoucai.common.dto.BaseResult;
import com.datoucai.common.dto.UserInfoDto;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class UserRpcService {

    @Resource
    private UserFeignService userFeignService;

    public UserInfoDto getUserInfo(Long id) {
        if(id == null) {
            return null;
        }
        BaseResult<UserInfoDto> userInfoDtoBaseResult = userFeignService.queryUserInfoById(String.valueOf(id));
        if(!userInfoDtoBaseResult.getSuccess()){
            return null;
        }
        return userInfoDtoBaseResult.getData();
    }
}